package com.aaa.service.impl;

import com.aaa.dao.TesterFPADao;
import com.aaa.dao.TesterSASDAO;
import com.aaa.entity.Tester;
import com.aaa.service.TesterFPAService;
import com.aaa.service.TesterSASService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TesterSASServiceImpl implements TesterSASService {
    @Autowired
    private TesterSASDAO testerSASDAO;
    @Override
    public Page selectTester(Tester tester) {
        Page<Tester> page =PageHelper.startPage(tester.getPage(),tester.getLimit());
      List<Tester> testerList  = testerSASDAO.selectTester(tester);
      Page listPage= (Page) testerList;
        return listPage;
    }

    @Override
    public boolean deleteTesterById(Integer id) {
        int deleteTesterById = testerSASDAO.deleteTesterById(id);
        if (deleteTesterById>0){
            return true;
        }
        return false;
    }

    @Override
    public boolean deleteTesterBatch(String id) {
        int deleteTesterBatch = testerSASDAO.deleteTesterBatch(id);
        if (deleteTesterBatch>0){
            return true;
        }
        return false;
    }

    /**
    * @Author: WTH
    * @Description: 新增
    * @Date:2022-07-07 15:13
    * @Params: 
    */
    @Override
    public boolean addTester(Tester tester) {
        int i = testerSASDAO.addTester(tester);
        if(i>0){
            return true;
        }
        return false;
    }

    /**
    * @Author: WTH
    * @Description: 根据手机号查询
    * @Date:2022-07-07 15:38
    * @Params:
    */
    @Override
    public List<Tester> selectTesterByPhone(Tester tester) {
        List<Tester> testers = testerSASDAO.selectTesterByPhone(tester);
        return testers;
    }

    /**
    * @Author: WTH
    * @Description: 根据ID做查询，拿到当前测试人结果
    * @Date:2022-07-08 18:59
    * @Params:  * @param null
    * @return:
    */
    @Override
    public List<Tester> selectResultOne(Integer testerId) {
        List<Tester> testers = testerSASDAO.selectResultOne(testerId);
        return testers;
    }
}
